class Solution:
    def getPermutation(self, n,k) :
        import itertools
        listArray = [i for i in range(1,n+1)]
        A = list(itertools.permutations(listArray,n))
        TTT = ""
        for s in list(A[k-1]):
            TTT = TTT + str(s)
        return TTT

if __name__ == '__main__':
    n = 3
    k = 3
    A = Solution()
    print(A.getPermutation(n,k))